package com.sgb.kjwl.view.ui.adapter.enterprise;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.enterprise.ServiceProcessesEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class ServicePopNodeAdapter extends BaseRecycleAdapter<ServiceProcessesEntity> {

    private ImageView iv_line;
    private ImageView iv_line1;
    private TextView iv_title;
    private TextView iv_content;


    public ServicePopNodeAdapter(Context context, List<ServiceProcessesEntity> datas) {
        super(context, R.layout.item_service_pop_node, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final ServiceProcessesEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        iv_line = holder.itemView.findViewById(R.id.iv_line);
        iv_line1 = holder.itemView.findViewById(R.id.iv_line1);
        iv_title = holder.itemView.findViewById(R.id.iv_title);
        iv_content = holder.itemView.findViewById(R.id.iv_content);

        iv_line.setVisibility(holder.getIndex_position() == datas.size() - 1 ? View.GONE : View.VISIBLE);
        iv_line1.setVisibility(holder.getIndex_position() == 0 ? View.INVISIBLE : View.VISIBLE);
        iv_title.setText(entity.getNodeName());
        iv_content.setText(entity.getNodeInstructions());
    }
}
